package org.jvm.weechat;

import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;

public class ChatServer {

    public static void main(String[] args) {
        try {
            ServerSocket serverSocket =new ServerSocket(6666);
            System.out.println("聊天服务器一起动，等待客户端的链接");
            while (true){
                Socket socket =serverSocket.accept();
                System.out.println("链接完毕");
                try {
                    InputStream is= socket.getInputStream();
                    BufferedReader br =new BufferedReader(new InputStreamReader(is));
                    String message=br.readLine();
                  System.out.println(message+"message");

                }catch (Exception e){
                    e.printStackTrace();
                }

            }


        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
